package com.lch.designpattern.factory.simplefactory;

import com.lch.designpattern.factory.ICar;

/**
 * @author: liuchenhui
 * @create: 2019-04-14 19:58
 **/
public class CarFactory {

    public static ICar createCar(Class clzz) {
        try {
            if (clzz != null) {
                return (ICar) clzz.newInstance();
            }
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
        return null;
    }
}
